package SoftwarePrinciple.OpenClosePrinciple;

/**
 * @author: Themberfue
 * @date: 2025/8/7 11:25
 * @description:
 */
public class Main {
    public static void main(String[] args) {
        Shape[] shapes = {
                new Circle(5),
                new Rectangle(4, 6)
        };

        AreaCalculator calculator = new AreaCalculator();
        double totalArea = calculator.calculateTotalArea(shapes);
        System.out.println("总面积: " + totalArea);

        // 新增三角形时，无需修改现有类，只需添加Triangle类
        // Shape[] newShapes = {new Circle(5), new Rectangle(4, 6), new Triangle(3, 4)};
    }
}

